package com.androidcourse.controller;

import com.androidcourse.bean.SolarTermBean;
import com.androidcourse.service.HomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/home")
public class HomeController {

    @Autowired
    HomeService homeService;

    @RequestMapping(value = "/solarTermList" ,method = RequestMethod.GET)
    public Map  getSolarTermList(){
        List<SolarTermBean> solarTermList = homeService.getSolarTermList();
        Map<String ,Object> data = new HashMap<>();
        if (solarTermList!=null){
            data.put("code","00");
            data.put("msg","成功");
            data.put("list",solarTermList);
        }else {
            data.put("code","88");
            data.put("msg","失败");
        }
        return data;
    }


}
